//
//  HNSH_CartShopModel.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2023/3/2.
//

#import "HNSH_CartShopModel.h"

@implementation HNSH_CartShopModel

- (BOOL)selected {
    return [self cellChangeSelectedStatus];
}

- (void)headerChangeSelectedStatus:(BOOL)status {
    for (HNSH_CartShopItemModel *item in self.items) {
        item.selected = status;
    }
    self.selected = status;
}

- (BOOL)cellChangeSelectedStatus {
    BOOL isAll = YES;
    for (HNSH_CartShopItemModel *item in self.items) {
        if (!item.selected) {
            isAll = NO;
        }
    }
    self.selected = isAll;
    return isAll;
}

+ (NSDictionary *)modelContainerPropertyGenericClass{
    return @{
             @"items":HNSH_CartShopItemModel.class
            };
}

@end


@implementation HNSH_CartShopItemModel

+ (NSDictionary *)modelCustomPropertyMapper{
    return @{@"uid":@"id"};
}

@end
